package chapter10.Inferface;
//多态数组
public class InterfacePloyArr {
    public static void main(String[] args) {
        Usb[] usb = new Usb[3];
        Phone phone = new Phone();
        Phone phone1 = new Phone();
        Camera camera = new Camera();
//初始化
        usb[0] = phone;
        usb[1] = phone1;
        usb[2] = camera;

        for (int i = 0; i < usb.length; i++) {
            usb[i].start();
            usb[i].stop();
            if (usb[i] instanceof Phone) {
                ((Phone) usb[i]).call();
            }

        }
    }
}
